<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml"
	xmlns:ui="http://java.sun.com/jsf/facelets"
	xmlns:h="http://java.sun.com/jsf/html"
	xmlns:f="http://java.sun.com/jsf/core" xml:lang="en" lang="en">
	<h:head>
		<title>Search Bid Request</title>
		<link rel="stylesheet" type="text/css" href="../css/style.css" />
	</h:head>
	
	<ui:include src="ComponentCriteria.xhtml"></ui:include>

	<h:body>
		<h:form>
	
			<h:commandButton action="#{requestManager.findOpenRequestByComponent}"
				value="Buscar"></h:commandButton>
		</h:form>

		<br />
		<br />
		<h:form id="myForm" rendered="#{requestManager.showRequestList}">
			<h:outputLabel for="requests" value="Lista de Requests" />

			<h:panelGroup>
				<h:panelGrid columns="2">
					<h:panelGrid columns="1">
						<h:selectOneRadio id="radio1" layout="pageDirection"
							value="#{requestManager.requestIdSelected}">
							<f:selectItems value="#{requestManager.lstRequestItem}" />
						</h:selectOneRadio>
					</h:panelGrid>
					<h:panelGrid columns="1">
						<h:dataTable id="requestTable" var="requestBid"
							value="#{requestManager.lstRequest}" border="1">

							<h:column>
								<h:outputText value="#{requestBid.component.description}" />
							</h:column>
							<h:column>
								<h:outputText value="#{requestBid.quantity}" />
							</h:column>
							<h:column>
								$<h:outputText value="#{requestBid.priceThreshold}" />
							</h:column>
							<h:column>
								<h:outputText value="#{requestBid.status}" />
							</h:column>
						</h:dataTable>
					</h:panelGrid>
				</h:panelGrid>
			</h:panelGroup>
			<h:commandButton action="#{requestManager.getBidsRequest}"
				value="Consultar ofertas realizadas"></h:commandButton>
		</h:form>


		<br />
		<br />
		<h:dataTable id="dt1" value="#{requestManager.lstBid}" var="item"
			bgcolor="#F1F1F1" border="10" cellpadding="5" cellspacing="3"
			first="0" width="50%" dir="LTR" frame="hsides" rules="all"
			rendered="#{requestManager.showBidsList}">

			<f:facet name="header">
				<h:outputText value="Estos son los bids del request con id:" />
				<h:outputLabel value="#{requestManager.requestIdSelected}" />
			</f:facet>

			<h:column>
				<f:facet name="header">
					<h:outputText value="idBid" />
				</f:facet>
				<h:outputText value="#{item.idBid}"></h:outputText>
			</h:column>

			<h:column>
				<f:facet name="header">
					<h:outputText value="amount" />
				</f:facet>
				<h:outputText value="#{item.amount}"></h:outputText>
			</h:column>

			<h:column>
				<f:facet name="header">
					<h:outputText value="supplier" />
				</f:facet>
				<h:outputText value="#{item.supplier.username}"></h:outputText>
			</h:column>

		</h:dataTable>
		
        <h:outputLabel class="redFont" id="lblResult2" value="#{reviewBidresult}"/>
        <br/>
        <br/>
	</h:body>
</html>
